#!/bin/bash

# 桌面时钟启动脚本
# Desktop Timer Launcher Script

# 获取脚本所在目录
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"

# 切换到应用目录
cd "$SCRIPT_DIR"

# 检查Node.js是否安装
if ! command -v node &> /dev/null; then
    echo "错误: 未找到Node.js，请先安装Node.js"
    echo "Error: Node.js not found, please install Node.js first"
    exit 1
fi

# 检查npm是否安装
if ! command -v npm &> /dev/null; then
    echo "错误: 未找到npm，请先安装npm"
    echo "Error: npm not found, please install npm first"
    exit 1
fi

# 检查依赖是否已安装
if [ ! -d "node_modules" ]; then
    echo "正在安装依赖..."
    echo "Installing dependencies..."
    npm install
fi

# 启动应用
echo "启动桌面时钟..."
echo "Starting Desktop Timer..."
npm start 